<?php if (!empty($cambioOrden)): ?>
    <? //php debug($tagsOrden);   ?>
    <div class="widget">
        <?php //echo $idCambio;?>
        <div class="whead"><h6>Detalle de la orden <?php echo $cambioOrden['Cambiordene']['numero']; ?></h6><div class="clear"></div></div>
        <div class="shownpars">
            <table cellpadding="0" cellspacing="0" border="0" class="dTable">
                <thead>
                    <tr>
                        <th>Tags</th>                    
                        <th><strong>Monto</strong></th>
                        <th>Acciones</th>
                    </tr>
                </thead>            
                <tbody>
                    <?php $sum = 0; ?>
                    <?php foreach ($tagsOrden as $ot): ?>
                        <?php $id = $ot['CambiordenesTag']['id']; ?>
                        <tr>
                            <td><?php echo $ot['CambiordenesTag']['tag_id']; ?></td>                                      
                            <td>
                                <?php
                                $montoLi = $ot['CambiordenesTag']['monto'];
                                $sum += $montoLi;

                                $modMontoLita = $this->Number->format($montoLi, array(
                                    'places' => 2,
                                    'before' => ' ',
                                    'escape' => false,
                                    'decimals' => '.',
                                    'thousands' => ','
                                        ));
                                echo $modMontoLita;
                                ?>
                            </td>
                            <td>
                                <?php echo $this->Html->link('EDITAR', array('controller' => 'Tags', 'action' => 'editalistado', $id)); ?> - 
                                <?php echo $this->Html->link('ELIMINAR', array('action' => 'eliminartagsco', $ot['CambiordenesTag']['id']), null, ('Desea Eliminar?')); ?>
                            </td>
                        </tr>
                    <?php endforeach; ?>
                </tbody>
            </table> 
            <table cellpadding="0" cellspacing="0" width="100%" class="tDark">
                <thead>
                <th>Monto llenado</th>
                <th>Monto Sumado (Tags)</th>
                <th>Diferencia</th>
                </thead>
                <tbody>
                    <?php
                    $montoCo = $cambioOrden['Cambiordene']['monto'];
                    $montoComod = $this->Number->format($montoCo, array(
                        'places' => 2,
                        'before' => ' ',
                        'escape' => false,
                        'decimals' => '.',
                        'thousands' => ','
                            ));
                    ?>
                <td align="center"><h3><?php echo $montoComod; ?></h3></td>     
                <td align="center">
                    <h3>
                        <?php
                        $summod = $this->Number->format($sum, array(
                            'places' => 2,
                            'before' => ' ',
                            'escape' => false,
                            'decimals' => '.',
                            'thousands' => ','
                                ));
                        echo $summod;
                        ?>
                    </h3>
                </td>
                <td align="center">
                    <h3>
                        <?php
                        $montoCo = $cambioOrden['Cambiordene']['monto'];
                        $resta = $montoCo - $sum;
                        $resmod = $this->Number->format($resta, array(
                            'places' => 2,
                            'before' => ' ',
                            'escape' => false,
                            'decimals' => '.',
                            'thousands' => ','
                                ));
                        echo $resmod;
                        ?>
                    </h3>
                </td>                  
                </tbody>
            </table>
        </div>   
    </div>
<?php else: ?>
    <div class="widget">
        <?php //echo $idCambio;?>
        <div class="whead"><h6>Este cambio de orden no tiene tags</h6><div class="clear"></div></div>
    </div>
<?php endif; ?>
<?php echo $this->Html->link('INSERTAR NUEVO TAGS', array('controller' => 'Tags', 'action' => 'insertartag', $idCambio), array('class' => 'buttonS bGreen ')); ?>
